﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using AccessControl.Wpf.Messaging;
using AccessControl.Wpf.ViewModels;
using AccessControl.Wpf.Popuping;

namespace AccessControl.Wpf
{
	/// <summary>
	/// Interaction logic for MainWindow.xaml
	/// </summary>
	public partial class MainWindow : Window, IMessagingService, IPopupService
	{
		public MainWindow()
		{
			InitializeComponent();

			this.Content = new MainViewModel()
			{
				MessagingService = this,
				PopupService = this
			};
		}

		#region IMessagingService Members

		public MessageBoxResult Show(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon)
		{
			return MessageBox.Show(this, messageBoxText, caption, button, icon);
		}

		#endregion

		#region IPopupService Members

		public void ShowPopup(object data)
		{
			PopupWindow popup = new PopupWindow()
			{
				Owner = this,
				ShowInTaskbar = false,
				WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner,
				Content = data
			};

			popup.ShowDialog();
		}

		#endregion
	}
}
